﻿namespace RainbowNavBar.Global
{
    public static partial class SystemGlobalStorage
    {

        /// <summary>
        /// Application TipBox.
        /// <para>应用程序弹窗</para>
        /// </summary>
        public static Window ApplicationTip { get; set; }

        /// <summary>
        /// Stores the main application form.
        /// <para>存储应用程序主窗体</para> 
        /// </summary>
        public static Window ApplicationWindow { get; set; }

        /// <summary>
        /// <para>存储标签管理窗口</para> 
        /// </summary>
        public static Window ApplicationTagList { get; set; } = null;

        /// <summary>
        /// <para>存储设置窗口</para> 
        /// </summary>
        public static Window ApplicationSettings { get; set; } = null;
    }

    /// <summary>
    /// Global Funciton.
    /// <para>全局方法</para>
    /// </summary>
    public static partial class SystemGlobalStorage
    {
        /// <summary>
        /// 信息提示框
        /// </summary>
        /// <param name="message"></param>
        public static void EMTip(string message, EMColor type = EMColor.Default)
        {
            if (ApplicationTip == null || ApplicationTip.Owner != ApplicationWindow)
            {
                ApplicationTip?.Close();
                ApplicationTip = null;
                ApplicationTip = new EPopupBox(ApplicationWindow, type, message);
            }
            ApplicationTip.Show();
        }

        /// <summary>
        /// 信息提示框，指定窗口
        /// </summary>
        /// <param name="window"></param>
        /// <param name="message"></param>
        /// <param name="type"></param>
        public static void EMTip(Window window,string message, EMColor type = EMColor.Default)
        {
            if (ApplicationTip == null || ApplicationTip.Owner != window)
            {
                ApplicationTip?.Close();
                ApplicationTip = null;
                ApplicationTip = new EPopupBox(window, type, message);
            }
            ApplicationTip.Show();
        }

        /// <summary>
        /// Pop up a message in the main window in global mode.
        /// <para>全局模式下在主窗体中弹出消息</para> 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="type"></param>
        public static void MessBox(string message, EMColor type = EMColor.Default)
        {
            EMTip(message, type);
        }

        /// <summary>
        /// 指定窗口弹出信息框
        /// </summary>
        /// <param name="window"></param>
        /// <param name="message"></param>
        /// <param name="type"></param>
        public static void MessBox(Window window,string message, EMColor type = EMColor.Default)
        {
            EMTip(window, message, type);
        }
    }
}
